/**
 * com.dingjian.base.util.SystemUtil.java
 */
package com.dingjian.basedata.util;

import com.dingjian.basedata.org.model.Org;
import com.dingjian.basedata.org.model.Position;
import com.dingjian.basedata.person.model.Person;

/**
 * 系统工具类
 * @author FengMy
 * 
 * @since 2012-9-17
 */
public class SystemUtil {
	private static ThreadLocal<Person> currentUser = new ThreadLocal<Person>();
	private static ThreadLocal<Org> currentControlUnit = new ThreadLocal<Org>();
	private static ThreadLocal<Org> currentOrg = new ThreadLocal<Org>();
	private static ThreadLocal<Position> currentPosition = new ThreadLocal<Position>();
	/**
	 * 获取当前登录用户
	 * @return
	 */
	public static Person getCurrentUser(){
		return currentUser.get();
	}
	
	public static void setCurrentUser(Person user){
		currentUser.set(user);
	}
	
	public static void setCurrentControlUnit(Org org){
		currentControlUnit.set(org);
	}
	
	/**
	 * 获取当前组织单元
	 * @return
	 */
	public static Org getCurrentControlUnit(){
		return currentControlUnit.get();
	}
	
	public static void setCurrentOrg(Org org){
		currentOrg.set(org);
	}
	
	public static void setCurrentPosition(Position position){
		currentPosition.set(position);
	}
	
	public static Org getCurrentOrg(){
		return currentOrg.get();
	}
	
	public static Position getCurrentPosition(){
		return currentPosition.get();
	}
}
